#!/bin/sh
#MYENV=`grep ora_prd /etc/passwd|awk -F: '{print $6}'`
sqlplus monitor/monitor@${ORACLE_SID} << EOF  >/dev/null
@/home/oracle/scripts/checkT.sql
EOF
cat /home/oracle/scripts/tablespace.txt|grep -v rows|awk 'BEGIN {print "TABLESPACE_NAME     MAX_SPACE SUM_BLOCKS USED_SPACE USED_RATE(%) FREE_SPACE(M)\n------------------ ---------- ---------- ---------- ------------ -------------"} {if ( $5> 30 || $6<300 ) print $0}'
rm /home/oracle/scripts/tablespace.txt
cat /home/oracle/scripts/flash_recovery_area_usage.txt|awk 'BEGIN {print "FILE_TYPE    PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES \n---------    ------------------ ------------------------- ---------------"} {print $0}' 
rm /home/oracle/scripts/flash_recovery_area_usage.txt
exit 0
